package com.alennus.blog.rabbitMq.spring_rabbit.simple;

import com.alennus.blog.rabbitMq.spring_rabbit.config.RabbitConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by pactera on 2018/9/25.
 */
@Component
public class Send {

    @Autowired
    public RabbitTemplate rabbitTemplate;

    public void send(){
        String sendMsg = "hello1 " + new Date();
        System.out.println("Sender1 : " + sendMsg);
        rabbitTemplate.convertAndSend(RabbitConfig.QUEUE_SIMPLE_HELLO_NAME,sendMsg);
    }







}
